package znbkTopicType.response;

import android.content.Context;
import android.graphics.Path;
import android.os.Handler;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.lancooznbk.R;

import org.apache.commons.lang3.StringEscapeUtils;

import lancooControl.Control;
import lancooControl.CustomAnswerChoiceView;
import znbkTestPaperCtfd.activity.WrongTopicTutoringPaperActivity;
import znbkTestPaperInfor.ZnbkPaperDef;
import znbkTestPaperNtxl.activity.TrainingDifficultProblemsPaperActivity;
import znbkTestPaperRdqh.activity.WeekAscensionPaperActivity;
import znbkTestPaperXtfx.activity.SystemReviewPaperActivity;

import static znbkTestPaperCtfd.activity.WrongTopicTutoringPaperActivity.mEntityCtfd;
import static znbkTestPaperNtxl.activity.TrainingDifficultProblemsPaperActivity.mEntityNtxl;
import static znbkTestPaperRdqh.activity.WeekAscensionPaperActivity.mEntityRdqh;
import static znbkTestPaperXtfx.activity.SystemReviewPaperActivity.mEntityXtfx;
import static znbkTopicType.content.ZnbkContentPptAdapter.TotalItemCount;
import static znbkTopicType.content.ZnbkContentPptAdapter.analysis;
import static znbkTopicType.content.ZnbkContentPptAdapter.optionContent;
import static znbkTopicType.content.ZnbkContentPptAdapter.optionIndex;
import static znbkTopicType.content.ZnbkContentPptAdapter.smallSubChileAnswer;
import static znbkTopicType.content.ZnbkContentPptAdapter.smallSubChileStuAnswer;
import static znbkTopicType.content.ZnbkContentPptAdapter.status;
import static znbkTopicType.content.ZnbkContentPptAdapter.sumOption;

/**
 * Created by Administrator on 2018\2\26 0026.
 */

public class ZnbkResponsePptAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    //当前试题数量
    private int SumItem;
    //当前试题在当前试题的ID
    private int PaperID;
    //当前小题ID
    private int OptionID;
    private Context mContext;

    private int ModelFrom;


    private int tvBlack;
    private int tvBlue;
    private int tvWhite;
    private int tvGreen;
    private int tvRed;
    private int btnWhite;
    private int btnBlue;
    private int btnGreen;
    private int btnRed;

    private ViewHolder holder = null;
    private class ViewHolder{
        TextView TvItemContent;//大题文本题干
        LinearLayout LayoutOptions;//选项显示区
        LinearLayout LayoutCheckAnalysis;//答案显示区
        LinearLayout LayoutStuAnswer;
        LinearLayout LayoutAnswer;
        LinearLayout LayoutAnalysis;
        TextView TvAnswer;//正确答案
        TextView TvStuAnswer;//学生答案
        TextView TvAnalysis;//解析
        TextView TvAnswerAmount;//小题总数

        private ViewHolder(View convertView) {
            TvItemContent = (TextView) convertView.findViewById(R.id.tv_itemContent);
            LayoutOptions = (LinearLayout) convertView.findViewById(R.id.layout_options);
            LayoutCheckAnalysis = (LinearLayout) convertView.findViewById(R.id.layout_checkAnalysis);
            LayoutStuAnswer = (LinearLayout) convertView.findViewById(R.id.layout_stuAnswer);
            LayoutAnswer = (LinearLayout) convertView.findViewById(R.id.layout_answer);
            LayoutAnalysis = (LinearLayout) convertView.findViewById(R.id.layout_analysis);
            TvAnswer = (TextView) convertView.findViewById(R.id.tv_answer);
            TvStuAnswer = (TextView) convertView.findViewById(R.id.tv_stuAnswer);
            TvAnalysis = (TextView) convertView.findViewById(R.id.tv_analysis);
            TvAnswerAmount = (TextView) convertView.findViewById(R.id.tv_answerAmount);
        }
    }




    public ZnbkResponsePptAdapter(Context context, int sumItem, int paperID,int optionID, int modelFrom) {
        mInflater = LayoutInflater.from(context);
        this.mContext = context;
        this.SumItem = sumItem;
        this.PaperID = paperID;
        this.OptionID = optionID;
        this.ModelFrom = modelFrom;
    }

    @Override
    public int getCount() {
        return SumItem;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.znbk_adapter_response_xzt_item, null);
            holder = new ViewHolder(convertView);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }


        /*
        * 获取试题相关信息
        * */
        getQuesInfor();

        /*
        * 展示作答区内容及实现作答流程
        * */
        showQuesInfor();

        /*
        * 已提交状态下，初始化答案解析
        * */
        showAnalysis();

        return convertView;
    }

    /*
    * 获取试题相关信息
    * */
    private void getQuesInfor(){

        tvBlack = mContext.getResources().getColor(R.color.black);
        tvBlue = mContext.getResources().getColor(R.color.blue);
        tvWhite = mContext.getResources().getColor(R.color.white);
        tvGreen = mContext.getResources().getColor(R.color.green);
        tvRed = mContext.getResources().getColor(R.color.red);

        btnWhite = R.mipmap.option_normal;
        btnBlue = R.mipmap.option_select;
        btnGreen = R.mipmap.option_right;
        btnRed = R.mipmap.option_wrong;

        if(ModelFrom== ZnbkPaperDef.FROM_TRAINING_DIFFICULT_PROBLEMS) {

        }else if(ModelFrom == ZnbkPaperDef.FROM_SYSTEM_REVIEW){

        }else if(ModelFrom == ZnbkPaperDef.FROM_WEEK_ASCENSION){

        }

    }

    /*
    * 展示试题信息
    * */
    Handler htmlHandlerItemContent = new Handler();
    private CustomAnswerChoiceView[] ChoiceAnswer;//选项信息
    private void showQuesInfor(){

        holder.TvAnswerAmount.setText("本题包含"+TotalItemCount+"个小题");

        /*
        * 显示题目题干
        * */
        String itemContent = StringEscapeUtils.unescapeXml("(" + String.valueOf(OptionID+1) + ")");

        final String finalItemContent = itemContent;
        new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                final Spanned tvItemContent = Html.fromHtml(finalItemContent, Control.imgGetter,null);
                htmlHandlerItemContent.post(new Runnable()
                {
                    @Override
                    public void run()
                    {
                        holder.TvItemContent.setText(tvItemContent);
                        holder.TvItemContent.setTextSize(18);
                    }
                });
            }
        }).start();


        /*
        * 显示选项内容
        * */
        ChoiceAnswer = new CustomAnswerChoiceView[sumOption];
        for(int i =0;i<sumOption;i++){
            ChoiceAnswer[i] = new CustomAnswerChoiceView(mContext);
            ChoiceAnswer[i].setAnswerChoice(optionIndex[i],tvBlack,btnWhite,optionContent[i],tvBlack);


            final int finalI = i;
            ChoiceAnswer[i].setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("===status===", "======status===000===" + status);
                    if (status==2||status==3) {
                        return;
                    }else {

                        if(ModelFrom==ZnbkPaperDef.FROM_SYSTEM_REVIEW){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    SystemReviewPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_WEEK_ASCENSION){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    WeekAscensionPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_TRAINING_DIFFICULT_PROBLEMS) {

                                for (int k = 0; k < sumOption; k++) {
                                    if (finalI == k) {
                                        ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                        smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                        mEntityNtxl.setAnswerState(1);
                                        TrainingDifficultProblemsPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                    } else {
                                        ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                    }
                                }
                                String strStuAnswer = "";
                                for (int i = 0; i < TotalItemCount; i++) {
                                    if (i == 0) {
                                        strStuAnswer = smallSubChileStuAnswer[i];
                                    } else {
                                        strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                    }
                                }
                                Log.e("==stuAnswer==0==", "" + strStuAnswer);
                                setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_WRONG_TOPIC_TUTORING){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    int RecAnswerState = mEntityCtfd.getRecQues().get(0).getAnswerState();
                                    if(RecAnswerState==0){
                                        mEntityCtfd.getRecQues().get(0).setAnswerState(1);
                                    }
                                    WrongTopicTutoringPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }
                    }
                }
            });

            ChoiceAnswer[i].BtnChoice.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("===status===", "======status===111===" + status);
                    if (status==2||status==3) {
                        return;
                    }else {

                        if(ModelFrom==ZnbkPaperDef.FROM_SYSTEM_REVIEW){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    SystemReviewPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_WEEK_ASCENSION){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    WeekAscensionPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_TRAINING_DIFFICULT_PROBLEMS) {

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);
                                    mEntityNtxl.setAnswerState(1);
                                    TrainingDifficultProblemsPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }else if(ModelFrom==ZnbkPaperDef.FROM_WRONG_TOPIC_TUTORING){

                            for (int k = 0; k < sumOption; k++) {
                                if (finalI == k) {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvWhite, btnBlue, optionContent[k], tvBlue);
                                    smallSubChileStuAnswer[OptionID] = Control.asciiToString(k + 65);

                                    int RecAnswerState = mEntityCtfd.getRecQues().get(0).getAnswerState();
                                    if(RecAnswerState==0){
                                        mEntityCtfd.getRecQues().get(0).setAnswerState(1);
                                    }

                                    WrongTopicTutoringPaperActivity.mSbtnSubmit.setTextColor(tvWhite);
                                } else {
                                    ChoiceAnswer[k].setAnswerChoice(optionIndex[k], tvBlack, btnWhite, optionContent[k], tvBlack);
                                }
                            }
                            String strStuAnswer = "";
                            for (int i = 0; i < TotalItemCount; i++) {
                                if (i == 0) {
                                    strStuAnswer = smallSubChileStuAnswer[i];
                                } else {
                                    strStuAnswer = strStuAnswer + "$、" + smallSubChileStuAnswer[i];
                                }
                            }
                            Log.e("==stuAnswer==0==", "" + strStuAnswer);
                            setSubChildStuAnswer(strStuAnswer);

                        }
                    }
                }
            });

            holder.LayoutOptions.addView(ChoiceAnswer[i]);

        }

        if (status==2||status==3) {
            //已提交
            int currentOption = -1;
            int currentTrueOption = -1;
            /*
            * 学生答案不为空
            * */
            if(!smallSubChileStuAnswer[OptionID].equals("")){
                currentOption = Integer.valueOf(Control.stringToAscii(smallSubChileStuAnswer[OptionID])) - 65;
                currentTrueOption = Integer.valueOf(Control.stringToAscii(smallSubChileAnswer[OptionID])) - 65;
                if (smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])) {
                    for (int k = 0; k < sumOption; k++) {
                        if (currentOption == k) {
                            ChoiceAnswer[k].setAnswerChoice(optionIndex[k],tvWhite,btnGreen,optionContent[k],tvGreen);
                        }
                    }
                } else if (!smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])) {
                    for (int k = 0; k < sumOption; k++) {

                        if (currentOption == k) {
                            ChoiceAnswer[k].setAnswerChoice(optionIndex[k],tvWhite,btnRed,optionContent[k],tvRed);
                        }
                        if(currentTrueOption == k){
                            ChoiceAnswer[k].setAnswerChoice(optionIndex[k],tvWhite,btnGreen,optionContent[k],tvGreen);
                        }
                    }
                }
            }
            /*
            * 学生答案为空
            * */
            else{
                currentTrueOption = Integer.valueOf(Control.stringToAscii(smallSubChileAnswer[OptionID])) - 65;
                for (int k = 0; k < sumOption; k++) {
                    if(currentTrueOption == k){
                        ChoiceAnswer[k].setAnswerChoice(optionIndex[k],tvWhite,btnGreen,optionContent[k],tvGreen);
                    }
                }
            }
        }else{
            //未提交
            if (!smallSubChileStuAnswer[OptionID].equals("")) {

                int trueOption = Integer.valueOf(Control.stringToAscii(smallSubChileStuAnswer[OptionID])) - 65;
                Log.e("==AAA=11=", "======trueOption======" + trueOption);

                for (int k = 0; k < sumOption; k++) {
                    if (trueOption == k) {
                        ChoiceAnswer[k].setAnswerChoice(optionIndex[k],tvWhite,btnBlue,optionContent[k],tvBlue);
                    }
                }

            }

        }

    }


    /*
    * 已提交状态试题分析部分内容展示
    * */
    private void showAnalysis() {

        if(ModelFrom==ZnbkPaperDef.FROM_SYSTEM_REVIEW||
                ModelFrom==ZnbkPaperDef.FROM_WEEK_ASCENSION||
                ModelFrom==ZnbkPaperDef.FROM_TRAINING_DIFFICULT_PROBLEMS||
                ModelFrom==ZnbkPaperDef.FROM_HISTORY_RECOMMEND_QUESTION) {

                if (status == 2 || status == 3) {

                    /*
                    * 显示题目回看解析内容
                    * */
                    holder.LayoutCheckAnalysis.setVisibility(View.VISIBLE);

                    /*
                    * 显示我的答案
                    * */
                    if(!smallSubChileStuAnswer[OptionID].equals("")) {
                        holder.TvStuAnswer.setText(smallSubChileStuAnswer[OptionID]);
                    }else{
                        holder.TvStuAnswer.setText(R.string.znbk_no_answered);
                    }
                    if(smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])){
                        holder.TvStuAnswer.setTextColor(tvGreen);
                    }else{
                        holder.TvStuAnswer.setTextColor(tvRed);
                    }

                    /*
                    * 正确答案
                    * */
                    holder.TvAnswer.setText(smallSubChileAnswer[OptionID]);
                    holder.TvAnswer.setTextColor(tvGreen);

                    /*
                    * 答案解析
                    * */
                    if (!analysis.equals("")) {
                        holder.TvAnalysis.setText(analysis);
                    } else {
                        holder.TvAnalysis.setText(R.string.znbk_no_analysis);
                    }
                    holder.TvAnalysis.setTextColor(tvBlack);

                } else {
                    holder.LayoutCheckAnalysis.setVisibility(View.GONE);
                }
        }
          /*
        * 错题辅导
        * */
        else if (ModelFrom == ZnbkPaperDef.FROM_WRONG_TOPIC_TUTORING) {

            if (PaperID == 0) {

                //显示题目回看解析内容
                holder.LayoutCheckAnalysis.setVisibility(View.VISIBLE);
                holder.LayoutStuAnswer.setVisibility(View.VISIBLE);
                //我的答案
                if (smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])) {
                    holder.TvStuAnswer.setTextColor(tvGreen);
                } else {
                    holder.TvStuAnswer.setTextColor(tvRed);
                }
                if (!smallSubChileStuAnswer[OptionID].equals("")) {
                    holder.TvStuAnswer.setText(smallSubChileStuAnswer[OptionID]);
                } else {
                    holder.TvStuAnswer.setText(R.string.znbk_no_answered);
                }
                //正确答案
                holder.TvAnswer.setText(Html.fromHtml(smallSubChileAnswer[OptionID]));
                holder.TvAnswer.setTextColor(tvGreen);
                //答案解析
                if (!analysis.equals("")) {
                    holder.TvAnalysis.setText(analysis);
                } else {
                    holder.TvAnalysis.setText(R.string.znbk_no_analysis);
                }
                holder.TvAnalysis.setTextColor(tvBlack);

            } else if (PaperID == 1) {

                if (mEntityCtfd.getClassicalQues() != null) {
                    //显示题目回看解析内容
                    holder.LayoutCheckAnalysis.setVisibility(View.VISIBLE);
                    holder.LayoutStuAnswer.setVisibility(View.GONE);
                    //显示参考答案
                    holder.TvAnswer.setText(Html.fromHtml(smallSubChileAnswer[OptionID]));
                    holder.TvAnswer.setTextColor(tvGreen);
                    //显示答案解析
                    if (!analysis.equals("")) {
                        holder.TvAnalysis.setText(analysis);
                    } else {
                        holder.TvAnalysis.setText(R.string.znbk_no_analysis);
                    }

                } else {
                    if (status == 2 || status == 3) {
                        holder.LayoutCheckAnalysis.setVisibility(View.VISIBLE);
                        holder.LayoutStuAnswer.setVisibility(View.VISIBLE);
                        /*显示我的答案*/
                        if (!smallSubChileStuAnswer[OptionID].equals("")) {
                            holder.TvStuAnswer.setText(smallSubChileStuAnswer[OptionID]);
                            if (smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])) {
                                holder.TvStuAnswer.setTextColor(tvGreen);
                            } else {
                                holder.TvStuAnswer.setTextColor(tvRed);
                            }
                        } else {
                            holder.TvStuAnswer.setText(R.string.znbk_no_answered);
                            holder.TvStuAnswer.setTextColor(tvRed);
                        }
                        /*显示参考答案*/
                        holder.TvAnswer.setText(smallSubChileAnswer[OptionID]);
                        /*显示解析*/
                        if (!analysis.equals("")) {
                            holder.TvAnalysis.setText(analysis);
                        } else {
                            holder.TvAnalysis.setText(R.string.znbk_no_analysis);
                        }
                    } else {
                        holder.LayoutCheckAnalysis.setVisibility(View.GONE);
                    }
                }
            } else {
                if (status == 2 || status == 3) {
                    holder.LayoutCheckAnalysis.setVisibility(View.VISIBLE);
                    holder.LayoutStuAnswer.setVisibility(View.VISIBLE);
                    /*显示我的答案*/
                    if (!smallSubChileStuAnswer[OptionID].equals("")) {
                        holder.TvStuAnswer.setText(smallSubChileStuAnswer[OptionID]);
                        if (smallSubChileStuAnswer[OptionID].equals(smallSubChileAnswer[OptionID])) {
                            holder.TvStuAnswer.setTextColor(tvGreen);
                        } else {
                            holder.TvStuAnswer.setTextColor(tvRed);
                        }
                    } else {
                        holder.TvStuAnswer.setText(R.string.znbk_no_answered);
                        holder.TvStuAnswer.setTextColor(tvRed);
                    }
                    /*显示参考答案*/
                    holder.TvAnswer.setText(smallSubChileAnswer[OptionID]);
                    /*显示解析*/
                    if (!analysis.equals("")) {
                        holder.TvAnalysis.setText(analysis);
                    } else {
                        holder.TvAnalysis.setText(R.string.znbk_no_analysis);
                    }
                } else {
                    holder.LayoutCheckAnalysis.setVisibility(View.GONE);
                }
            }
        }


    }

    /*
    * 写入作答信息
    * */
    private void setSubChildStuAnswer(String strStuAnswer){
        if(ModelFrom==ZnbkPaperDef.FROM_SYSTEM_REVIEW){
            mEntityXtfx.getModelSinglePaperInfo().getModelTKQueList().get(PaperID).getChildList().get(0).getSubChildList().get(0).setSubChildStuAnswer(strStuAnswer);
        }else if(ModelFrom==ZnbkPaperDef.FROM_WEEK_ASCENSION){
            mEntityRdqh.getModelSinglePaperInfo().getModelTKQueList().get(PaperID).getChildList().get(0).getSubChildList().get(0).setSubChildStuAnswer(strStuAnswer);
        }else if(ModelFrom== ZnbkPaperDef.FROM_TRAINING_DIFFICULT_PROBLEMS){
            mEntityNtxl.getTKQue().getChildList().get(0).getSubChildList().get(0).setSubChildStuAnswer(strStuAnswer);
        }else if(ModelFrom==ZnbkPaperDef.FROM_WRONG_TOPIC_TUTORING){
            int anotherPaperID = -1;
            if(mEntityCtfd.getClassicalQues()!=null){
                anotherPaperID = PaperID-2;
            }else{
                anotherPaperID = PaperID-1;
            }
            mEntityCtfd.getRecQues().get(anotherPaperID).getTKQue().getChildList().get(0).getSubChildList().get(0).setSubChildStuAnswer(strStuAnswer);
        }
    }


}